package com.vn.ducktohome.screen;

import com.badlogic.gdx.Screen;
import com.vn.ducktohome.enums.ScreenEnum;

public class ScreenManager {
	private Screen screen;

	public ScreenManager() {
		
	}

	public Screen getScreen() {
		if (screen == null) {
			screen = new MenuScreen();
//			screen.show();
		}
		return screen;
	}

	public Screen createScreen(ScreenEnum scr) {
		switch (scr) {
			case MENU_SCREEN:
				clearScreen();
				screen = new MenuScreen();
				return screen;
			case PLAY_SCREEN:
				clearScreen();
				screen = new PlayScreen();
				return screen;
			case TEST_SCREEN:
				clearScreen();
				screen = new TestScreen();
				return screen;
			case SELECT_LEVEL_SCREEN:
				clearScreen();
				screen = new SelectLevelScreen();
				return screen;
			case WIN_LEVEL_SCREEN:
				clearScreen();
				screen = new WinLevelScreen();
				return screen;
			case LOSE_LEVEL_SCREEN:
				clearScreen();
				screen = new LoseLevelScreen();
				return screen;
			}
		return new MenuScreen();
	}

	private void clearScreen() {
		if (screen != null)
			screen.dispose();
	}
}
